<template>
  <teleport v-if="visible" :to="portal">
    <div class="modal">
      <slot />
    </div>
  </teleport>
</template>

<script setup>
import { watch } from "vue";
import Dialog from "../Dialog";

defineProps({
  portal: {
    type: String,
    default: () => "body"
  },
  visible: {
    type: Boolean,
    default: () => false
  }
});
</script>

<style scoped lang="less">
.modal {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.8s ease;
  background: rgba(0, 0, 0, 0.5);
}
</style>
